package cc.geeksearch.ble

import android.bluetooth.BluetoothManager
import android.content.Context

object WalleUtil {

    /**
     * 判断蓝牙是否打开
     * @param context 上下文
     * @return 蓝牙是否打开
     */
    fun bluetoothIsOpen(context: Context): Boolean {
        val manager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?
        val mBluetoothAdapter = manager!!.adapter
        return mBluetoothAdapter != null && mBluetoothAdapter.isEnabled
    }
}